function div = div(y,x)

% both y and x are vectors

div = y./x;
for i=1:length(x)
   if x(i)==0
       div(i)=0;
   end
end

% Taken directly from the replication package for
% 
% Timmer, Marcel P., Abdul Azeez Erumban, Bart Los, Robert Stehrer, and Gaaitzen J. de Vries.
%  “Slicing Up Global Value Chains.” Journal of Economic Perspectives 28, no. 2 (May 2014): 99–118. 
% https://doi.org/10.1257/jep.28.2.99